using System;
using System.Collections.Generic;
using System.Text;

namespace GoogleNet
{
    /// <summary>
    /// A container for one or more geometry primitives associated with the same feature.
    /// </summary>
    public class KmlMultiGeometry : KmlGeometry, IKmlElement, IKmlGeometry
    {
        private string tagName = "MultiGeometry";

        #region Geometries
        private List<IKmlGeometry> geometries = new List<IKmlGeometry>();

        /// <summary>
        /// Gets or sets the geometries included in this MultiGeometry.
        /// </summary>
        /// <value>The geometries.</value>
        public List<IKmlGeometry> Geometries
        {
            get { return geometries; }
            set { geometries = value; }
        } 
        #endregion

        #region IKmlElement Members

        /// <summary>
        /// Name of the KML tag for this specific element.
        /// </summary>
        /// <value></value>
        /// <returns></returns>
        string IKmlElement.TagName
        {
            get { return tagName; }
        }

        #endregion

        #region IKmlGenerator Members

        /// <summary>
        /// Generates the KML for this element including its child elements.
        /// </summary>
        /// <param name="writer">The XML writer that will be used to generate the KML.</param>
        void IKmlGenerator.GenerateKml(System.Xml.XmlTextWriter writer)
        {
            writer.WriteStartElement(tagName);
            base.GenerateKml(writer);
            
            foreach (IKmlGeometry currentGeometry in geometries)
                currentGeometry.GenerateKml(writer);
    
            writer.WriteFullEndElement();
        }

        #endregion
    
    }
}
